package com.ljt.kotlinandmvvm.orderfrom.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.ljt.kotlinandmvvm.orderfrom.fragment.*

/**
 * @auther :lujiantao
 * @date :2024/5/5 3:05 PM
 * @desc :订单viewpager的适配器
 */
class OrderFromViewPagerAdapter(fm:FragmentManager):FragmentPagerAdapter(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {

    private val listFragments = listOf(WholeFragment(),UnpaidFragment(),PaidFragment(),CommletedFragment(),CancledFragment(),RefundedFragment())
    private val listTitles = listOf("全部","未支付","已支付","已完成","已取消","已退款")

    override fun getCount(): Int {
        return listFragments.size
    }

    override fun getItem(position: Int): Fragment {
        return listFragments[position]
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return listTitles[position]
    }
}